<!--
 * @Author: wuwk
 * @Date: 2021-12-20 13:33:05
 * @LastEditors: wuwk
 * @LastEditTime: 2021-12-22 10:20:25
 * @Description: 申报人数情况
-->
<template>
  <div class="wrap">
    <chartTitle title="今日申报人数情况" />
    <div class="block-num">
      <div class="block-item">
        <img class="prefix-img" src="@/assets/img/sbrs.svg" alt="" />
        <div class="content">
          <p class="t">申报人数</p>
          <div class="n">
            <dv-digital-flop :config="sbrsConfig" class="digital" />
          </div>
        </div>
      </div>
      <div class="block-item">
        <img class="prefix-img" src="@/assets/img/zcrs.svg" alt="" />
        <div class="content">
          <p class="t">注册人数</p>
          <div class="n">
            <dv-digital-flop :config="zcrsConfig" class="digital" />
          </div>
        </div>
      </div>
    </div>
    <div class="decoration">
      <dv-decoration-2 />
    </div>
    <div class="block-bottom">
      <div class="b-item" v-for="item in sbrsList" :key="item.name">
        <span class="iconfont prefix">&#xe629;</span>
        <span class="tit">{{ item.name }}</span>
        <dv-digital-flop :config="item.config" class="digital" />
      </div>
    </div>
  </div>
</template>

<script>
import chartTitle from "_c/chartTitle.vue";
import { numConversion } from "@/common/utils";
export default {
  name: "ProjectSbrsqk",

  components: {
    chartTitle,
  },
  data() {
    return {
      sbrsConfig: {
        number: [100100035],
        content: "{nt}万人",
        formatter: this.formatNum,
        textAlign: "left",
        style: {
          fontSize: 18,
          fill: "#00d8ff",
          fontStyle: "bold",
        },
      },
      zcrsConfig: {
        number: [200204563],
        content: "{nt}万人",
        formatter: this.formatNum,
        textAlign: "left",
        style: {
          fontSize: 18,
          fill: "#00d8ff",
          fontStyle: "bold",
        },
      },
      sbrsList: [
        {
          name: "非豁免补税",
          value: 100100200,
          config: {},
        },
        {
          name: "豁免补税",
          value: 100100300,
          config: {},
        },
        {
          name: "申报退税",
          value: 100100400,
          config: {},
        },
        {
          name: "不补不退",
          value: 100100500,
          config: {},
        },
      ],
    };
  },

  mounted() {
    this.formatData();
  },

  methods: {
    formatData() {
      let obj = {
        content: "{nt}万人",
        formatter: this.formatNum,
        textAlign: "left",
        style: {
          fontSize: 14,
          fill: "#ffffff",
        },
      };
      this.sbrsList.forEach((item) => {
        item.config = {
          ...obj,
          number: [item.value],
          formatter: this.formatNum,
        };
      });
    },
    formatNum(num) {
      let obj = numConversion({ numString: num, unit: "万" });
      return obj.value;
    },
  },
};
</script>

<style lang="scss" scoped>
.wrap {
  padding: 20px;
  position: relative;
  .block-num {
    display: flex;
    .block-item {
      flex: 1;
      display: flex;
      margin-top: 16px;
      height: 50px;
      &:not(:first-child) {
        margin-left: 8px;
      }
      .prefix-img {
        width: 45px;
        vertical-align: top;
      }
      .content {
        margin-left: 8px;
        position: relative;
        .t {
          font-size: 12px;
        }
        .n {
          color: #00d8ff;
          .digital {
            position: absolute;
            width: 120px;
            height: 30px;
            bottom: -8px;
            left: -1px;
          }
          .unit {
            font-size: 12px;
            margin-left: 5px;
          }
        }
      }
    }
  }
  .decoration {
    display: flex;
    margin: 12px 0;
    justify-content: center;
    .dv-decoration-2 {
      width: 200px;
      height: 8px;
    }
  }
  .block-bottom {
    overflow: hidden;
    .b-item {
      width: 49%;
      float: left;
      display: flex;
      &:nth-child(even) {
        margin-left: 6px;
      }
      .prefix {
        color: rgb(0, 216, 255);
        font-size: 12px;
      }
      .tit {
        font-size: 12px;
        margin-left: 4px;
        display: inline-block;
        width: 60px;
      }
      .digital {
        // width: 120px;
        flex: 1;
        height: 30px;
        margin-top: -3px;
        margin-left: 6px;
      }
    }
  }
}
</style>
